home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
asm_n_z.zip
/
SUPPRESS.ASM
< prev
next >
Wrap
Assembly Source File
|
1987-03-12
|
13KB
|
479 lines
; NOTE : This template is for .COM files only do not use for .EXE files!!
;
;
;
; Copyright 1986 by Dana Nowell - All rights reserved
;
; HISTORY:
; Version Date Name Description
; 1.0 11/10/86 dn first cut
; 1.01 11/11/86 dn masked all foreground colors
; either on or off
; 1.02 11/14/86 dn masked all background colors
; either on or off
; 1.03 11/22/86 dn added check for already resident
; 1.04 11/23/86 dn fixed bug with black on black displays
; 1.05 11/30/86 dn set color suppressed mode at install
; incase program checks.
; moved copyright message to after
; equipment check call so monochrome
; can be properly determined
; 1.06 12/27/86 dn trapped for pixel and tty writes
; moved color remap to a subroutine
; added mode variable to trap for
; graphics mode differences
; 1.07 03/12/87 dn trapped for dark grey on black
;
title SUPPRESS.ASM
NULL equ 00h
BELL equ 07h ; bell character
BACKSPACE equ 08h ; backspace character
TAB equ 09h ; tab character
LF equ 0ah ; line feed
F_FEED equ 0ch ; form feed
CR equ 0dh ; carriage return
EOF equ 1ah ; ctrl z ( end of file )
SPACE equ ' ' ; ascii space character
QUOTE equ '"'
SIGNATURE1 equ 6144h ; used for already
SIGNATURE2 equ 616eh ; resident check
DOS_INT equ 21h ; DOS function interrupt
DISP_CHAR equ 02h
GET_KEY equ 08h
DOS_SCR_MSG equ 09h
DOS_SET_INT equ 25h
DOS_RESIDENT equ 31h
DOS_GET_INT equ 35h
DOS_TERMINATE equ 4ch
DOS_STRING_TERM equ '$'
BIOS_ACTIVE_PAGE equ 5
BIOS_SET_VIDEO_MODE equ 0
BIOS_SET_CURSOR_SIZE equ 1
; Interrupt vectors used
HOOK_INT equ 10h ; interrupt to be hooked
PAGE_NUMBER equ 0 ; active page to be set if color moniter
VIDEO_MODE equ 2 ; color 80 x 25 with 4 grey colors
CURSOR_SIZE equ 0607h ; color monitor cursor 6x7
;------------------------------------------------------------------------------
;
; MACRO SECTION
;
;------------------------------------------------------------------------------
Version_msg macro
jmp short copyright_end
copyright_msg db CR, LF
db 'SUPPRESS - Version 1.07', CR, LF
db 'Copyright 1986, Dana Nowell ', CR, LF, CR, LF
db 'May be distributed without license', CR, LF, '$'
copyright_end:
Msg copyright_msg
endm
Msg macro ptr
push dx
push ax
lea dx, ptr
mov ah, 09h
int 21h
pop ax
pop dx
endm
com segment para public 'code'
assume cs:com, ds:com, es:com
org 100h ; required for COM file ( skips PSP )
start:
jmp install ; install the demon
;-------------------------------------------------------------------
;
; resident data structures go here
;
;-------------------------------------------------------------------
old_int dd 0 ; original value of hooked interrupt
resident1 dw SIGNATURE1
resident2 dw SIGNATURE2
mode dw 0 ; 0 = text - 1 = graphics
;-------------------------------------------------------------------
;
; new interrupt starts here
;
;-------------------------------------------------------------------
new_int:
pushf
cmp ah, 0eh
je write_tty
cmp ah, 9
je write_character
cmp ah, 0ah
je write_attribute
cmp ah, 6
je scroll
cmp ah, 7
je scroll
cmp ah, 0ch
je write_pixel
cmp ah, 13h
je write_string
cmp ah, 0
je set_mode
jmp do_int
write_pixel:
push bx ; save bx
mov bl, al ; pixel color is in al so move in to bl
call remap_color ; remap the pixel color
mov al, bl ; put color back into al
pop bx ; restore original bx
jmp do_int
write_tty:
call remap_color ; attribute in bl
jmp do_int
write_character:
call remap_color ; not mixed - attribute in bl
jmp do_int
write_string:
cmp al, 1
jg mixed_attributes ; attribute bytes and chars mixed in a string
call remap_color ; not mixed - attribute in bl
jmp do_int
mixed_attributes: ; stub for now
jmp do_int
scroll:
and bh, 8fh ; set blank lines to black
jmp do_int
set_mode:
mov cs:mode, 0 ; mark as text mode
cmp al, 4
jl text
mov cs:mode, 1 ; really graphics mode
cmp al, 5
jle mgraphics
jmp do_int
text:
cmp al, 1
jg htext
ltext:
mov al, 0
jmp do_int
htext:
mov al, 2
jmp do_int
mgraphics:
mov al, 5
jmp do_int
write_attribute:
call remap_color
;-------------------------------------------------------------------
;
; be well behaved and pass control to original int
;
;-------------------------------------------------------------------
do_int:
popf
pushf
call dword ptr cs:old_int ; do old interrupt
iret ; bye bye
remap_color proc near
push dx
push bx
; test bl, 08h
; jz not_grey
;
; push bx
; and bl, 77h
; pop bx
; jnz not_grey
cmp bl, 88h
je grey
cmp bl, 08h
jne not_grey
grey:
pop bx
or bl, 01h
push bx
not_grey:
mov dl, 00h ; assume black background, black characters
and bl, 77h ; AND color and background in character
jz black ; no color or background - so use default
mov dl, 70h ; assume color background, black characters
and bl, 07h ; and color in character
jz black ; no color - so use color background
mov dl, 07h ; assume black background, color characters
pop bx ; restore original bx
and bl, 8fh ; set background off leave colors on and
; attributes as before ( blink & intensity )
push bx ; set-up for next pop
black:
pop bx
or bl, dl ; mask it for readability